﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MemoryDuosControl;

namespace MemoryDuosInterfaz
{
    public partial class RankingGlobal : Form
    {
        private List<PuntuacionRanking> ranking;

        public RankingGlobal()
        {
            InitializeComponent();
        }

        private void RankingGlobal_Load(object sender, EventArgs e)
        {
            Ranking_Global rg = new Ranking_Global();
            ranking = rg.recogerRanking();
            // listBoxRanking.Items.Add(String.Format("{0,-20} {1,-35} {2,-35}", "Posición",
            // "Usuario", "Puntuación"));

            foreach (var rank in ranking)
            {
                
                //listBoxRanking.Items.Add(rank.Nombre.PadRight(60 - rank.Nombre.Length) + rank.Puntuacion.ToString());//.PadLeft(30 - rank.Puntuacion.ToString().Length));
                dataGridView1.Rows.Add(rank.Nombre, rank.Puntuacion);
      
            }

            //System.Object[] ItemObject = new System.Object[ranking.Count];
            //for (int i = 0; i < ranking.Count; i++)
            //{
            //    string line = String.Format("{0,-20} {1,-35} {2,-35}", (i + 1), ranking.ElementAt(i).Nombre, ranking.ElementAt(i).Puntuacion);
            //    listBoxRanking.Items.Add(line);
            //    //listBox1.Items.Add((i + 1) + "\t" + String.Format("{0,5}", ranking.ElementAt(i).Nombre) + ranking.ElementAt(i).Puntuacion);
            //    //listBox1.Items.Add(ranking.ElementAt(i).Nombre);
            //    //listBox1.Items.Add(ranking.ElementAt(i).Nombre);
            //    //ItemObject[i] = (i + 1) + "\t" + ranking.ElementAt(i).Nombre + "\t\t\t" + ranking.ElementAt(i).Puntuacion;
            //}

            //listBox1.Items.AddRange(ItemObject);
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

 
    }
}
